<div class="bjui-pageHeader">
    <!-- 顶部模块[如：功能按钮、搜索面板] -->
    <div class="bjui-row col-md-11">
        <button type="button" class="btn-green pull-right" onclick="add()">新增</button>
    </div>
</div>
<div class="bjui-pageContent">
    <!-- 内容区 -->
    <table id="departTable"></table>
    <script>
        var deparment = {
            deparmentData:{},
        }
        $('#departTable').datagrid({
            dataUrl: URL+'findPageSmOrg.do',
            filterThead:false,
            height:'90%',
            columns: [
                {name:'orgId',label:'ID',width:300},
                {name: 'orgName', label: '部门名称',align:'center',width:300},
                {name: 'upOrgName', label: '所属科室', align: 'center',width:300},
                {name: 'leader', label: '负责人',align:'center',width:300},
                {name: 'leaderTel', label: '联系方式', align: 'center',width:300},
                {name:'fp',label:'操作',align:'center',width:500,
                    render:function(value, data){return "<a class='operation-btn operation-btn-normal'onclick='update("+JSON.stringify(data)+")'>修改</a>" +
                        "<a class='operation-btn operation-btn-del' onclick='del("+JSON.stringify(data)+")'>删除</a>"}}
            ]
        })

        function add() {
            BJUI.dialog({
                id:'addDepartment',
                url:'html/hospital/addDepartment.html',
                title:'新增部门'
            })

        }

        function update(data) {
            deparment.deparmentData = data;
            BJUI.dialog({
                id:'addDepartment',
                url:'html/hospital/updateDepartment.html',
                title:'新增部门'
            })
        }

        function del(data) {
            BJUI.ajax('doajax', {
                url: URL+'deleteSmOrgById.do',
                data:{
                    orgId:data.orgId,
                },
                loadingmask: true,
                okCallback: function(json, options) {
                    //刷新表格
                    $('#departTable').datagrid('refresh');
                }
            });
        }
    </script>
</div>